package com.fesine.ch02.t16;

/**
 * @description: 不使用volatile关键字，会使异步调用死循环
 * @author: Fesine
 * @createTime:2016/7/12 17:13
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/12 17:13
 */
public class RunThread extends Thread {
    volatile private boolean isRunning = true;

    public boolean isRunning() {
        return isRunning;
    }

    public void setIsRunning(boolean isRunning) {
        this.isRunning = isRunning;
    }

    @Override
    public void run() {
        System.out.println("进入run了");
        while (isRunning == true) {

        }
        System.out.println("线程被停止了！");
    }
}
